package window;


import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class welcome {
	String id="";
	public JFrame WelFrame;

	/**
	 * Launch the application.
	 */

	/**
	 * Create the application.
	 */
	public welcome(String id) {
		this.id=id;
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		WelFrame = new JFrame();
		WelFrame.setResizable(false);
		WelFrame.setTitle("欢迎");
		ImageIcon icon=new ImageIcon("D:\\eclipse\\workspace\\TeacherInformationManagementSystem\\src\\window\\1.png");
		WelFrame.setIconImage(icon.getImage());
		WelFrame.setBounds(500, 200, 450, 300);
		WelFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		WelFrame.getContentPane().setLayout(null);
		
		JLabel label = new JLabel("教师信息管理系统");
		label.setForeground(Color.DARK_GRAY);
		label.setFont(new Font("幼圆", Font.BOLD, 20));
		label.setBounds(132, 10, 180, 43);
		WelFrame.getContentPane().add(label);
		
		JLabel label_1 = new JLabel("欢迎你，亲爱的");
		label_1.setForeground(Color.DARK_GRAY);
		label_1.setFont(new Font("幼圆", Font.BOLD, 13));
		label_1.setBounds(117, 63, 112, 43);
		WelFrame.getContentPane().add(label_1);
		
		JLabel label_2 = new JLabel("");
		label_2.setForeground(Color.DARK_GRAY);
		label_2.setFont(new Font("幼圆", Font.BOLD, 13));
		label_2.setBounds(231, 63, 81, 43);
		label_2.setText(id);
		WelFrame.getContentPane().add(label_2);
		
		JButton btnNewButton = new JButton("教师信息管理");
		btnNewButton.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				if(e.getKeyCode()==KeyEvent.VK_ENTER)
					btnNewButton.doClick();
			}
		});
		btnNewButton.setFont(new Font("幼圆", Font.PLAIN, 12));
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				TeacherHomepage th=new TeacherHomepage(id);
				th.teacherHomepageFrame.setVisible(true);
				WelFrame.dispose();;
			}
		});
		btnNewButton.setBounds(97, 127, 112, 23);
		WelFrame.getContentPane().add(btnNewButton);
		
		JLabel lblNewLabel = new JLabel("最新公告：");
		lblNewLabel.setFont(new Font("幼圆", Font.PLAIN, 13));
		lblNewLabel.setForeground(Color.RED);
		lblNewLabel.setBounds(97, 213, 73, 15);
		WelFrame.getContentPane().add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("11/25 我校信工大三进行体测");
		lblNewLabel_1.setFont(new Font("幼圆", Font.PLAIN, 13));
		lblNewLabel_1.setBounds(174, 213, 190, 15);
		WelFrame.getContentPane().add(lblNewLabel_1);
		
		JButton btnNewButton_1 = new JButton("text");
		btnNewButton_1.setFont(new Font("幼圆", Font.PLAIN, 12));
		btnNewButton_1.setBounds(231, 127, 112, 23);
		WelFrame.getContentPane().add(btnNewButton_1);
	}
}
